/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mscs.server.promotion.logic;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Vector;
import mscs.data.IToStringArrayCallBack;
import mscs.data.ITotalDiscountProxy;
import mscs.data.pojo.TotalDiscount;

/**
 *
 * @author Administrator
 */
public class TotalDiscountUtil extends GiftDiscountUtil<TotalDiscount>{
    public TotalDiscountUtil() {
        super(new ITotalDiscountProxy());
    }
    public Vector<Vector<String>> toDataVector(){
        return toDataVector(new TotalDiscountCallback());
    }
}
class TotalDiscountCallback implements IToStringArrayCallBack {
    public Vector<String> toStringArray(Object obj) {
        if(obj != null) {
            TotalDiscount totalDiscount = (TotalDiscount)obj;
            Vector<String> stringArray = new Vector<String>();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            stringArray.add(String.valueOf(totalDiscount.getUpperLimit()));
            stringArray.add(String.valueOf(totalDiscount.getLowerLimit()));
            stringArray.add(String.valueOf(totalDiscount.getDiscountRate() * 100));
            stringArray.add(sdf.format(totalDiscount.getStartDate()));
            stringArray.add(sdf.format(totalDiscount.getEndDate()));
            return stringArray;
        }
        return null;
    }
}
